import 'storage.dart';


class UserService {
  // 获取用户信息
  static Future<List> getUserInfo() async {
    List? userinfo = await Storage.getData("userinfo");
    if (userinfo != null) {
      return userinfo;
    } else {
      return [];
    }
  }
  
 // 获取用户登录状态
  static Future<bool> getUserLoginState() async{
    List userInfo = await getUserInfo();
    if (userInfo.isNotEmpty && userInfo[0]["username"] != "") {
      return true;
    } else {
      return false;
    }
  }


 
  // 删除用户信息
  static Future<bool> removeUserInfo(String keywords) async {
    List? userinfo = await Storage.getData("userinfo");
    if (userinfo != null) {
      return await Storage.removeData("userinfo");
    }
    return false;
  }

 
}